ComponentOne Input for WinForms
Bar Style
Using the C1Input Controls > C1Input Controls > C1RangeSlider Control Overview > C1RangeSlider Appearance > Bar Style

You can manage the appearance of C1RangeSlider control through various Bar Style options.

BackColor

Back color of C1RangeSlider bar can be changed at design time or through code.

To change the back color in design time complete the following:

  1. Right-click the C1RangeSlider control and select Properties option.
  2. In Properties pane expand the Styles node.
  3. Select BackColor property from BarStyle collection.
  4. In the drop-down menu corresponding to BackColor property, select Lavender.

To change the back color at run-time, add the following code in FormLoad event:

To write code in Visual Basic

Visual Basic
Copy Code
Me.C1RangeSlider1.Styles.BarStyle.BackColor = System.Drawing.Color.Lavender

To write code in C#

C#
Copy Code
this.c1RangeSlider1.Styles.BarStyle.BackColor = System.Drawing.Color.Lavender;

BorderColor

To change the border color in design time complete the following:

  1. Right-click the C1RangeSlider control and select Properties option.
  2. In Properties pane expand the Styles node.
  3. Select BorderColor property from BarStyle collection.
  4. In the drop-down menu corresponding to BorderColor property, select MediumBlue.

To change the border color at run-time, add the following code in FormLoad event:

To write code in Visual Basic

Visual Basic
Copy Code
Me.C1RangeSlider1.Styles.BarStyle.BorderColor = System.Drawing.Color.MediumBlue

To write code in C#

C#
Copy Code
this.c1RangeSlider1.Styles.BarStyle.BorderColor = System.Drawing.Color.MediumBlue;

Run your project and observe the customizations. Following image shows the changed back color and border color of range bar in C1RangeSlider control:

DisabledBackColor

DisabledBackColor property enables you to set the background color of range bar, which will be visible when the C1RangeSlider control is disabled.

To change the DisabledBackColor in design time complete the following:

  1. Right-click the C1RangeSlider control and select Properties option.
  2. In Properties pane expand the Styles node.
  3. Select DisabledBackColor property from BarStyle collection.
  4. In the drop-down menu corresponding to DisabledBackColor property, select ScrollBar.

To change the DisabledBackColor at run-time, add the following code in FormLoad event:

To write code in Visual Basic

Visual Basic
Copy Code
Me.C1RangeSlider1.Styles.BarStyle.DisabledBackColor = System.Drawing.SystemColors.ScrollBar

To write code in C#

C#
Copy Code
this.c1RangeSlider1.Styles.BarStyle.DisabledBackColor = System.Drawing.SystemColors.ScrollBar;

DisabledBorderColor

DisabledBorderColor property enables you to set the border color of range bar, which will be visible when the C1RangeSlider control is disabled.

To change the DisabledBorderColor in design time complete the following:

  1. Right-click the C1RangeSlider control and select Properties option.
  2. In Properties pane expand the Styles node.
  3. Select DisabledBorderColor property from BarStyle collection.
  4. In the drop-down menu corresponding to DisabledBorderColor property, select Red.

 

To change the DisabledBorderColor at run-time, add the following code in FormLoad event:

To write code in Visual Basic

Visual Basic
Copy Code
Me.C1RangeSlider1.Styles.BarStyle.DisabledBorderColor = System.Drawing.Color.Red

To write code in C#

C#
Copy Code
this.c1RangeSlider1.Styles.BarStyle.DisabledBorderColor = System.Drawing.Color.Red;

Set the Enabled property to False, and run the project. Following image shows disabled back color and disabled border color of range bar in the C1RangeSlider control:

See Also